<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="部门" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<link href="/css/dtree.css" rel="stylesheet" type="text/css">
<script src="/js/dtree.js"></script>
<script language="javascript">
	function doTreeNodeClick(id){
		if(document.getElementById("currentId")!=null){
			document.getElementById("currentId").value=id;
		}
		parent.document.getElementById("mainFrame").src="/base/StafferListForSelect.ihtm?type=${type}&department_id="+id;
	}
	var normalHeight=0;
	function doInit(){
		normalHeight=document.getElementById("scrollDiv").offsetHeight;
		d.openAll();
		var defaultId="${defaultId}";
		if(defaultId!=""){
			doTreeNodeClick(defaultId);
			//d.openTo(defaultId,true,false);
		}else{
			//d.openAll();
		}
	}
	function fixDivHeight(type){
		if(type=="NORMAL"){
			document.getElementById("scrollDiv").style.height=normalHeight+"px";
		}else{
			document.getElementById("scrollDiv").style.height=(normalHeight-100)+"px";
		}
	}
</script>
</head>
<body oncontextmenu="return false" onLoad="doInit();"  style="text-align:center" scroll="no">
	<div class="nav" id="scrollDiv" style="text-align:left;overflow-x:hidden;overflow-y:auto;height:348px;width:160px">
	  <h3 class="title">部门</h3>
	  <div class="nav-link nav-mail" style="width:100%">			
				<div class="blank12"></div>
				<script language="javascript">
					<!--
					var isOpen=false;
					var d = new dTree('d','/images/dtree');
					
					d.config.useCookies=false;
					d.config.useLines=true;
					d.config.useIcons=true;
					
					d.add(0,-1,'Root');
					<c:forEach var="item" items="${departmentList}">
						d.add(${item.id},${item.parentId},'<c:out value="${item.departmentName}" />',"javascript:doTreeNodeClick('${item.id}');",'','','',false);
					</c:forEach>
					
					document.write(d);
					d.closeAll();
					//-->
				</script>
	  </div>
	</div>
</body>
</html>